define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'csmonline/tableonlinetrace/index',
                }
            });
            var table = $("#table");
            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                sortName: 'createtime',
                columns: [
                    [
                        {field: 'id', title: __('Id'), operate: false},
                        {field: 'title', title: __('页面标题')},
                        {field: 'url', title: __('访问链接')},
                        {field: 'querystring', title: __('链接参数')},
                        {field: 'calccountry', title: __('国家')},
                        {field: 'calcprovince', title: __('省区')},
                        {field: 'calccity', title: __('城市')},
                        {field: 'calcisp', title: __('ISP')},
                        {field: 'calismobile', title: __('访问设备'), searchList: {"Y":__('手机'),"N":__('PC电脑')}, formatter: Table.api.formatter.status},
                        {field: 'calplatform', title: __('终端')},
                        {field: 'calbrowser', title: __('浏览器')},
                        {field: 'calbrowserversion', title: __('浏览器版本')},
                        {field: 'durationseconds', title: __('访问持续时间')},
                    ]
                ],
                queryParams:function (params) {
                    return {
                        search: params.search,
                        sort: params.sort,
                        order: params.order,
                        filter: JSON.stringify({userid: $("#userid").val()}),
                        op: JSON.stringify({userid: '='}),
                        offset: params.offset,
                        limit: params.limit,
                    };
                },
                //普通搜索
                commonSearch: true,
                titleForm: '', //为空则不显示标题，不定义默认显示：普通搜索
            });
            // 为表格绑定事件
            Table.api.bindevent(table);  
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});